#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "ui_addnewfeedialog.h"


MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    connect(ui->LogisticsManagementAction,SIGNAL(triggered()),this,SLOT(on_LogisticsManagementAction));

    logisticsModel();
}

MainWindow::~MainWindow()
{
    delete ui;
}




void MainWindow::on_LogisticsManagementAction_triggered()   //点击触发跳转物流页
{
    ui->stackedWidget->setCurrentWidget(ui->logisticsManagementPage); //跳转至物流管理页
}
void MainWindow::logisticsModel() //设置表模型
{

    static QSqlQueryModel *logisModel=new QSqlQueryModel(ui->logisticsTableView);
    logisModel->setQuery(QString("SELECT *FROM logisticsfees"));

    logisModel->setHeaderData(0,Qt::Horizontal,tr("编号"));
    logisModel->setHeaderData(1,Qt::Horizontal,tr("登记日期"));
    logisModel->setHeaderData(2,Qt::Horizontal,tr("快递公司"));
    logisModel->setHeaderData(3,Qt::Horizontal,tr("快递单号"));
    logisModel->setHeaderData(4,Qt::Horizontal,tr("发件人"));
    logisModel->setHeaderData(5,Qt::Horizontal,tr("发件人电话"));
    logisModel->setHeaderData(6,Qt::Horizontal,tr("发件人地址"));
    logisModel->setHeaderData(7,Qt::Horizontal,tr("收件人"));
    logisModel->setHeaderData(8,Qt::Horizontal,tr("收件人电话"));
    logisModel->setHeaderData(9,Qt::Horizontal,tr("收件人地址"));
    logisModel->setHeaderData(10,Qt::Horizontal,tr("签收日期"));
    logisModel->setHeaderData(11,Qt::Horizontal,tr("费用"));
    logisModel->setHeaderData(12,Qt::Horizontal,tr("创建日期"));


    ui->logisticsTableView->setModel(logisModel);
}

void MainWindow::on_logisticsAddFeePushButton_clicked() //新增物流费用按键
{
    addNewFeeDialog *addFeeDialog=new addNewFeeDialog;  //弹出新增内容窗口
    addFeeDialog->show();
}

